//2009/08/22 21:54:29
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class DistanceBetweenStrings
{
public:
    int getDistance(string a, string b, string letterSet)
    {//Take care of the case of the letters.
		int sum = 0;
        vector<int> v1(letterSet.size(), 0);
        vector<int> v2(letterSet.size(), 0);
		for(int i=0; i<letterSet.size(); i++) letterSet[i] = tolower(letterSet[i]);
        for (int i=0; i<a.size(); i++)
        {
			a[i] = tolower(a[i]);
            size_t pos = letterSet.find(a[i]);
            if (pos != string::npos)
            {
                v1[pos] ++;
            }
        }
        for (int i=0; i<b.size(); i++)
        {
			b[i] = tolower(b[i]);
            size_t pos = letterSet.find(b[i]);
            if (pos != string::npos)
            {
                v2[pos] ++;
            }
        }
        for (int i=0; i<v1.size(); i++)
		{
            sum += (v1[i] - v2[i]) * (v1[i] - v2[i]);
			cout << letterSet[i] << " " << v1[i] << " " << v2[i] << endl;
		}
		return sum;
    }
};
